package com.sinosoft.service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.sinosoft.domain.UserDTO;
import com.sinosoft.hystrix.Fallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author loujiang
 * @date 2020/12/23 2:41 下午
 * @NOTE:
 */

@FeignClient(value = "user-center", fallback = Fallback.class)
public interface IServer {

    @RequestMapping("/err")
    String error();

    @GetMapping("/retry")
    String Retry(@RequestParam("time") int time);


    @GetMapping("/retry1")
    @HystrixCommand(commandProperties = @HystrixProperty(name="execution.isolation.thread.timeoutInMillseconds",
            value = "2000"))
    String Retry1(@RequestParam("time") int time);


    @GetMapping("/sayHi")
    String sayHi();

    @GetMapping("/user/getUser")
    UserDTO getUser(@RequestParam("name") String name);

}
